package cn.xopencode.recordservice.manager.pdroom;

import cn.xopencode.recordservice.convert.pdroom.PowerDistributionRoomConvert;
import cn.xopencode.recordservice.rpc.pdroom.dto.PowerDistributionRoomCreateDTO;
import cn.xopencode.recordservice.rpc.pdroom.vo.PowerDistributionRoomVO;
import cn.xopencode.recordservice.service.pdroom.PowerDistributionRoomService;
import cn.xopencode.recordservice.service.pdroom.bo.PowerDistributionRoomBO;
import cn.xopencode.recordservice.service.pdroom.bo.PowerDistributionRoomCreateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PowerDistributionRoomManager {

    @Autowired
    private PowerDistributionRoomService powerDistributionRoomService;

    public Integer createPowerDistributionRoom(PowerDistributionRoomCreateDTO createDTO) {
        PowerDistributionRoomCreateBO bo = PowerDistributionRoomConvert.INSTANCE.convert(createDTO);
        Integer result = powerDistributionRoomService.createPowerDistributionRoom(bo);
        return result;
    }

    public List<PowerDistributionRoomVO> getPowerDistributionRoomList(String roomName){
        List<PowerDistributionRoomBO>  roomBOList = powerDistributionRoomService.getPowerDistributionRoomList(roomName);
        return PowerDistributionRoomConvert.INSTANCE.convertList02(roomBOList);
    }
}
